import http from "@/common/http/request";
import {
  loginInterface,
} from "./user.interface";

// 获取验证码
export const $getCodeImg = () => {
  const $http = new http();
  return $http.get({
    url: '/captchaImage',
    needToken: false,
  })
}

// 登录
export const $login = (data: loginInterface) => {
  const $http = new http();
  return $http.post({
    url: '/login',
    data,
    needToken: false,
  })
}

// 退出方法
export const $logout = () => {
  const $http = new http();
  return $http.post({
    url: '/logout',
    data: {},
  })
}

// 获取用户详细信息
export const $getInfo = () => {
  const $http = new http();
  return $http.get({
    url: '/getInfo',
  })
}

// 用户路由
export const $getRouters = () => {
  const $http = new http();
  return $http.get({
    url: '/getRouters',
  })
}